//the character messages are posted to the calling threads massage queue,to be read dispatch message(&msq);
//dispatches a message to a window procedure 
}
retuen msg.wparam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM IParam)
//(handle to window, message identifier,first messsage parameter ,second message parameter )
{
switch(msg)
{
case WM_CLOSE:// WM_CLOSE messsage is sent as a signal that window or an appplication should terminate 
// An application can prompt the user for confirmation, prior to destorying a window.
//by processing the WM_CLOSE message and calling the destory window only if the user confirms the choice 
destory window (hwnd);
break;
case WM_DESTORY://The WM_DESTORY message is sent when a window is being destoryed. It is send to the window. 